#pragma once
template<class iterator, class Ref, class Ptr>
struct Reverse_iterator
{
	typedef Reverse_iterator<iterator, Ref, Ptr> self;
	iterator _node;
	Reverse_iterator(iterator n)
		:_node(n)
	{}
	Ref operator*()
	{
		iterator tmp = _node;
		--tmp;
		return *tmp;
	}
	Ptr operator->()
	{
		return &_node;
	}
	self& operator++()
	{
		_node--;
		return *this;
	}
	self& operator--()
	{
		_node++;
		return *this;
	}
	self operator++(int)
	{
		self tmp(*this);
		_node--;
		return tmp;
	}
	self operator--(int)
	{
		self tmp(*this);
		_node++;
		return tmp;
	}
	bool operator!=(const self& s)
	{
		return _node != s._node;
	}
	bool operator==(const self& s)
	{
		return _node == s._node;
	}
};